package com.xs.bean;

public class PageBean {
	private int nowPage; // 当前页
	private int count; // 总记录内容数量
	private int pageSize = 4; // 每页显示内容数量
	private int totalPage; // 总页数

	// 获得起始行数的方法,为了分页便利
	public int getStart() {

		return (nowPage - 1) * pageSize;
	}

	/**
	 * @return the nowPage
	 */
	public int getNowPage() {
		return nowPage;
	}

	/**
	 * @param nowPage
	 *            the nowPage to set
	 */
	public void setNowPage(int nowPage) {
		this.nowPage = nowPage;
	}

	/**
	 * @return the count
	 */
	public int getCount() {
		return count;
	}

	/**
	 * @param count
	 *            the count to set
	 */
	public void setCount(int count) {
		this.count = count;
	}

	/**
	 * @return the pageSize
	 */
	public int getPageSize() {
		return pageSize;
	}

	/**
	 * @param pageSize
	 *            the pageSize to set
	 */
	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}

	/**
	 * @return the totalPage
	 */
	public int getTotalPage() {
		// 这里运用三目运算得到总页数,
		return count % pageSize == 0 ? count / pageSize : count / pageSize + 1;
	}

	/**
	 * @param totalPage
	 *            the totalPage to set
	 */
	public void setTotalPage(int totalPage) {
		this.totalPage = totalPage;
	}

	public PageBean(int nowPage, int count, int pageSize, int totalPage) {
		super();
		this.nowPage = nowPage;
		this.count = count;
		this.pageSize = pageSize;
		this.totalPage = totalPage;
	}

	public PageBean() {
		super();
	}
}
